import  { request,requestMock }  from "@/utils/http" 

//请求首页的三级列表
export const  requestCategoryList =()=>{
  return  request.get("/api/product/getBaseCategoryList")
}
//请求轮播图数据

export const requestBannerList =()=>{
  return requestMock.get("/banner")

}
//请求floor的数据
export const requestFloorList=()=>{
    return requestMock.get("/floor")

}
//请求search的数据
export const requestSearchList =(params)=>{
    return request.post("/api/list",params)
}
//请求detail的数据
export const requestDetailList = (skuId)=>{
    return request.get(`/api/item/${skuId}`)
}
//新增购物车 或者 修改购物车数量 的请求
export const requestAddCar =({skuId,skuNum})=>{
    return request.post(`/api/cart/addToCart/${ skuId }/${ skuNum }`)
}
//请求购物车列表的请求
export const requestCartList =()=>{
    return request.get("/api/cart/cartList")
}
//切换商品选中状态
export const requestUpdateSingleCheck =({skuId,isChecked})=>{
    return request.get(`/api/cart/checkCart/${skuId}/${isChecked}`)
}
//切换全选按钮状态
export const requestUpdateAllCheck =(isChecked,skuIdList)=>{
        return request.post(`/api/cart/batchCheckCart/${isChecked}`,skuIdList  )
}
//删除单个商品
export const requestDeleteSingleGood =(skuId)=>{
        return request.delete(`/api/cart/deleteCart/${skuId}`)
}
//删除全部已选中商品
export const requestDeleteAllGoods =(skuIdList)=>{
        return request.delete('/api/cart/batchDeleteCart',{
            data:skuIdList
        })
}
//获取验证码请求
export const requestRegisterCode =(phone)=>{
    return request.get(`/api/user/passport/sendCode/${phone}`)
}
//发送注册的请求
export const requestRegister = (registerInfo) => {
    return request.post(`/api/user/passport/register`, registerInfo);
  };
//登录请求
export const requestLogin =(userInfo)=>{
    return request.post('/api/user/passport/login',userInfo)
}
//登录后请求用户信息
export const requestUserInfo=()=>{
    return request.get('api/user/passport/auth/getUserInfo')
}
//退出登录,服务端会让当前token失效
export const requestLogout = () => {
    return request.get("/api/user/passport/logout");
  };
//请求交易数据
export const requestTradeList =()=>{
    return request.get('/api/order/auth/trade')
}
//请求交易页的地址数据
export const requestTradeAddress =()=>{
     return requestMock.get("/address")
       
}
//发送提交订单请求
export const requestAddTrade = (tradeNo, tradeInfo) => {
    return request.post(
      `/api/order/auth/submitOrder?tradeNo=${tradeNo}`,
      tradeInfo
    );
  };